﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace gChartSharp
{
    /// <summary>
    /// 
    /// </summary>
    public class MapColorParam : IChartParam
    {
        /// <summary>
        /// The name of the API
        /// </summary>
        public string Name { get { return "chco"; } }


        /// <summary>
        /// The color of any countries or states that do not have
        /// an explicit color defined.
        /// </summary>
        public Color BackgroundRegions { get; set; }


        /// <summary>
        /// 
        /// </summary>
        public List<Color> GradientColors
        {
            get { return mGradientColors ?? (mGradientColors = new List<Color>()); }
            set { mGradientColors = value; }
        }
        private List<Color> mGradientColors;


        /// <summary>
        /// The default constructor
        /// </summary>
        public MapColorParam() { }


        /// <summary>
        /// Renders the API text
        /// </summary>
        /// <returns></returns>
        public string Render()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(string.Format("&{0}={1}", this.Name, this.BackgroundRegions.ToHTML()));

            if (this.GradientColors.Count > 0)
                foreach (Color color in this.GradientColors)
                    sb.Append(string.Format(",{0}", color.ToHTML()));

            return sb.ToString();
        }

    }
}
